home *** CD-ROM | disk | FTP | other *** search
- /*
- TrapAvail — Determine the existence of a trap
- */
-
- #include <Types.h>
- #include <Traps.h>
- #include <OSUtils.h>
-
- short NumToolboxTraps(void);
- TrapType GetTrapType(short theTrap);
-
- Boolean TrapAvailable(short theTrap)
- {
- TrapType tType;
- Boolean isAvail;
-
- tType = GetTrapType(theTrap);
- if (tType == ToolTrap)
- {
- theTrap &= 0x07FF;
- if (theTrap >= NumToolboxTraps())
- theTrap = _Unimplemented;
- }
-
- isAvail = NGetTrapAddress(theTrap, tType) != NGetTrapAddress(_Unimplemented, ToolTrap);
- return isAvail;
- }
-
- short NumToolboxTraps()
- {
- if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xAA6E,ToolTrap))
- return 0x0200;
- else
- return 0x0400;
- }
-
- TrapType GetTrapType(short theTrap)
- {
- if ((theTrap & 0x0800) > 0)
- return ToolTrap;
- else
- return OSTrap;
- }
-
-